package com.zzyl.web.core;

import cn.hutool.core.map.MapUtil;

import cn.hutool.http.HttpUtil;
import org.junit.jupiter.api.Test;

import java.util.Map;

class WeatherCaseTest {
    private final String HOST = "http://tianqi3.market.alicloudapi.com/hour24";
    private final String APPCODE = "92dce07a6f064d97b26228806734b2cd";
    private final String AREA_CODE = "530700";
    @Test
    public void testWeatherApi() {
        Map<String, Object> build = MapUtil.<String, Object>builder()
                .put("areaCode", AREA_CODE)
                .build();
        String body = HttpUtil.createGet(HOST)
                .header("Authorization", "APPCODE " + APPCODE)
                .form(build).execute().body();
        System.out.println(body);
    }
    //查询快递
    private final String EXPRESS_HOST = "https://lhkdcx.market.alicloudapi.com/express/query";
    private final String waybillNo = "78946583421994";
    private final String  AppCode = "92dce07a6f064d97b26228806734b2cd";
    @Test
    void expressCaseTest() {
        Map<String, Object> build = MapUtil.<String, Object>builder()
                .put("waybillNo", waybillNo)
                .build();
        String body = HttpUtil.createPost(EXPRESS_HOST)
                .header("Authorization", "APPCODE " + AppCode)
                .form(build).execute().body();
        System.out.println(body);
    }
}





